<?php


namespace App\Http\observer;


use App\Models\ChartLog;
use App\Models\Image;

class ChartLogObserver
{
    public function deleted(ChartLog $chartLog)
    {
        if (!$chartLog["url"]){
            return null;
        }
        $image=Image::where("url",$chartLog["url"])->first();
        if ($image){
            Image::find($image["id"])->delete();
        }
    }
}
